#pragma once
#ifndef OHOS_RIVE_THREAD_STATE_PLS_H
#define OHOS_RIVE_THREAD_STATE_PLS_H

#include <memory>
// clang-format off
// Put #include "thread_state_egl.h" before #include "rive/renderer/gl/render_context_gl_impl.hpp".
// Otherwise, compilation errors will occur.
#include "thread_state_egl.h"
#include "rive/renderer/gl/render_context_gl_impl.hpp"
// clang-format on

namespace ohos_rive {
class PLSThreadState : public EGLThreadState {
public:
    PLSThreadState();
    ~PLSThreadState();

    rive::gpu::RenderContext *renderContext() const
    {
        return m_renderContext.get();
    }

    void destroySurface(EGLSurface eglSurface) override;

    void makeCurrent(EGLSurface eglSurface) override;

private:
    std::unique_ptr<rive::gpu::RenderContext> m_renderContext;

    // 1x1 Pbuffer surface that allows us to make the GL context current without
    // a window surface.
    EGLSurface m_backgroundSurface;
};
} // namespace ohos_rive

#endif // OHOS_RIVE_THREAD_STATE_PLS_H
